<?php

namespace app\common\command;

use app\common\library\Wxapp;
use fast\Http;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Exception;

class Test extends Command
{

    protected function configure()
    {
        $this->setName("test")->setDescription("测试");
    }

    protected function execute(Input $input,Output $output)
    {

        // 调用函数进行测试
        /*$currentLatitude = 28.202861;   // 当前纬度
        $currentLongitude = 112.971496; // 当前经度
        $lat2 = 28.202015;//距离维度
        $lnt2 = 112.971312;//距离经度
        $a = distance($currentLatitude,$currentLongitude,$lat2,$lnt2);
var_dump($a);die;
        $obj = new Wxapp();
        try {
            $res = $obj->AuthLogin("0a3dsC100xbFoR1g7c300ajuQ43dsC1d");
            var_dump($res);die;
        }catch (Exception $e){
                var_dump($e->getMessage());die;
        }*/

        $obj = new \MapApi();
//        var_dump($obj->list_field_terminal());die;
//        var_dump($obj->create_field("entity_son_id","number"));
//        var_dump($obj->create_field("entity_type","string"));
//        var_dump($obj->create_field("user_id","number"));
//        var_dump($obj->create_field("type","number"));
//        var_dump($obj->create_field("status","number"));die;
        dump($obj->list_terminal());die;
//        dump($obj->delete_terminal("3_6"));die;
//        dump($obj->update_terminal("5_4","李师傅","订单哦",1,1));die;
//        dump($obj->create_terminal("order_1","这是测试","测试"));die;
//        dump($obj->create_track("order_1","28.197784","112.952521"));die;
        $r = $obj->search_track("4_4",time()-86400,time());
        var_dump($r);die;
        $track_list = $r["result"]["track"];
        $last_track = end($track_list);
        var_dump($last_track);die;
        dump($obj->search_terminal([
            "location"      => "28.2515,112.982434",
            "radius"        => "3000",
            "entity_type"   => "express",
            "type"          => 1,
//            "status"        => 1,
        ]));die;
    }




}